/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * LogDetalhe.java
 *
 * Created on 16/10/2011, 16:15:38
 */

package br.com.mailanalyzer.grafico;

import br.com.mailanalyzer.domain.Log;
import br.com.mailanalyzer.log.L;
import br.com.mailanalyzer.utils.Converte;
import java.awt.Color;

/**
 *
 * @author McLuck
 */
public class LogDetalhe extends javax.swing.JFrame {

    /** Creates new form LogDetalhe */
    public LogDetalhe(Log log) {
        initComponents();

        input_classe.setText(log.getReferencia());
        input_detalhes.setText(log.getDetalhe());
        input_quando.setText(Converte.ToStringDataVisual(log.getDataRegistro()).concat(" - ").concat(Converte.DateToStringTimer(log.getDataRegistro())));
        input_tag.setText(log.getTagApp());
        label_tipo.setText(L.GET_OCORRENCIA(log.getOcorrencia()));
        Color color = Color.decode(L.getColor(log.getOcorrencia()));
        label_tipo.setBackground(color);
        label_tipo.setOpaque(true);
        //setBackground(color);
        //label_tipo.setForeground(color);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        input_tag = new javax.swing.JTextField();
        input_classe = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        input_quando = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        input_detalhes = new javax.swing.JTextArea();
        label_tipo = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setText("TAG:");

        input_tag.setEditable(false);
        input_tag.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                input_tagActionPerformed(evt);
            }
        });

        input_classe.setEditable(false);
        input_classe.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                input_classeActionPerformed(evt);
            }
        });

        jLabel2.setText("Classe:");

        input_quando.setEditable(false);
        input_quando.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                input_quandoActionPerformed(evt);
            }
        });

        jLabel3.setText("Quando:");

        jLabel4.setText("Detalhes:");

        input_detalhes.setColumns(20);
        input_detalhes.setEditable(false);
        input_detalhes.setLineWrap(true);
        input_detalhes.setRows(5);
        jScrollPane1.setViewportView(input_detalhes);

        label_tipo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        label_tipo.setText("{OCO}");

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel3)
                    .add(input_tag, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
                    .add(jLabel1)
                    .add(input_classe, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
                    .add(jLabel2)
                    .add(input_quando, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
                    .add(jLabel4)
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
                    .add(label_tipo, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(21, 21, 21)
                .add(label_tipo)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jLabel1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(input_tag, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel2)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(input_classe, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(input_quando, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void input_tagActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_input_tagActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_input_tagActionPerformed

    private void input_classeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_input_classeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_input_classeActionPerformed

    private void input_quandoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_input_quandoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_input_quandoActionPerformed

    /**
    * @param args the command line arguments
    */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                new LogDetalhe().setVisible(true);
//            }
//        });
//    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField input_classe;
    private javax.swing.JTextArea input_detalhes;
    private javax.swing.JTextField input_quando;
    private javax.swing.JTextField input_tag;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel label_tipo;
    // End of variables declaration//GEN-END:variables

}
